﻿<?php
// ------------------------------------------------------------------
// NEEDED STUBS FOR THIS EXAMPLE
// ------------------------------------------------------------------


// this will include all needed files to be able to build a Request
include_once($CONF["STUBS_FOLDER"]."Map24MapletRemoteControl/Map24MapletRemoteControl.php5");


// ------------------------------------------------------------------
// NEEDED PARAMETERS FOR THIS REQUEST
// ------------------------------------------------------------------


// coordinates of the first location to add
$longitude1 = "400";
$latitude1 	= "3000";

// coordinates of the second location to add
$longitude2 = "410";
$latitude2 	= "3000";

// coordinates of the third location to add
$longitude3 = "420";
$latitude3 	= "3000";

// symbol used 	to display the first location
$symbolId1	= "101";

// symbol used 	to display the second location
$symbolId2	= "202";

// symbol used 	to display the third location
$symbolId3	= "303";

// zoomlevel
$mapViewClippingWidth	= 5000;
$mapViewPercentage		= 75;


// ------------------------------------------------------------------
// BUILDING THE REQUEST
// ------------------------------------------------------------------


// here are all commands defined and are put together in one ArrayOfCommands

// this object will add the first location
$cmdIdx=0;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->DeclareMap24Location = new DeclareMap24Location();
$commands[$cmdIdx]->DeclareMap24Location->MapObjectID = "id1";
$commands[$cmdIdx]->DeclareMap24Location->Coordinate = new Coordinate();
$commands[$cmdIdx]->DeclareMap24Location->Coordinate->Longitude = $longitude1;
$commands[$cmdIdx]->DeclareMap24Location->Coordinate->Latitude = $latitude1;
$commands[$cmdIdx]->DeclareMap24Location->SymbolID = $symbolId1;

// this object will add a second location
$cmdIdx++;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->DeclareMap24Location = new DeclareMap24Location();
$commands[$cmdIdx]->DeclareMap24Location->MapObjectID = "id2";
$commands[$cmdIdx]->DeclareMap24Location->Coordinate = new Coordinate();
$commands[$cmdIdx]->DeclareMap24Location->Coordinate->Longitude = $longitude2;
$commands[$cmdIdx]->DeclareMap24Location->Coordinate->Latitude = $latitude2;
$commands[$cmdIdx]->DeclareMap24Location->SymbolID = $symbolId2;

// this object will add a third location
$cmdIdx++;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->DeclareMap24Location = new DeclareMap24Location();
$commands[$cmdIdx]->DeclareMap24Location->MapObjectID = "id3";
$commands[$cmdIdx]->DeclareMap24Location->Coordinate = new Coordinate();
$commands[$cmdIdx]->DeclareMap24Location->Coordinate->Longitude = $longitude3;
$commands[$cmdIdx]->DeclareMap24Location->Coordinate->Latitude = $latitude3;
$commands[$cmdIdx]->DeclareMap24Location->SymbolID = $symbolId3;

// this object will enable the new location on the map
$cmdIdx++;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->ControlMapObject = new ControlMapObject();
$commands[$cmdIdx]->ControlMapObject->Control = "ENABLE";
$commands[$cmdIdx]->ControlMapObject->MapObjectIDs = array("id1","id2","id3");

// this object will center the map above the new location
$cmdIdx++;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->SetMapView = new SetMapView();
$commands[$cmdIdx]->SetMapView->MapObjectIDs = array("id1","id2","id3");
$commands[$cmdIdx]->SetMapView->ClippingWidth = new SetMapViewClippingWidth();
$commands[$cmdIdx]->SetMapView->ClippingWidth->MinimumWidth = $mapViewClippingWidth;
$commands[$cmdIdx]->SetMapView->ClippingWidth->ViewPercentage = $mapViewPercentage;

// definition of the request header with Map24ID and SessionID
$header = new RequestHeader();
$header->Map24ID  = $CONF['MAP24_ID'];
$header->ClientID = $CONF['SESSION_ID'];

// definition of the request body
$request = new MapletRemoteControlRequest();
$request->Map24MRC = new Map24MRC();
$request->Map24MRC->Commands = $commands;


// ------------------------------------------------------------------
// EXECUTE THE REQUEST
// ------------------------------------------------------------------


// in this object the SoapClient will be initiated and executed
$mrc = new Map24MapletRemoteControl($CONF['MAPTP_SYSTEM'],$CONF['MAP24_ID'],$CONF['SESSION_ID']);
$response = $mrc->mapletRemoteControl($header,$request);


// ------------------------------------------------------------------
// OUTPUT THE RESULT
// ------------------------------------------------------------------


$resultString = "This command generates no output";
$counter = 0;
?>